/***************************************************************************
 *   Copyright (C) 2010 by programmeboy                                    *
 *   programmeboy@gmail.com                                                *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.                                        *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             * 
 ***************************************************************************/

#ifndef _IO__H__
#define _IO__H__

typedef union 
{
	struct 
	{
		unsigned __int32 LowPart;
		unsigned __int32 HighPart;
	};
	unsigned __int64 Value;

}UINT64_STRUCT, *PUINT64_STRUCT;

#pragma pack(1)

typedef struct PartitionEntryMBR
{
	char boot_indicator;
	char start_head;
	char start_cylsector;
	char start_cylinder;
	char type;
	char end_head;
	char end_sector;
	char end_cylinder;
	unsigned __int32 start_LBA;
	unsigned __int32 sector_count_LBA;

}PARTITION_ENTRY_MBR, *PPARTITION_ENTRY_MBR;

typedef struct _MBR
{
	char code[446];
	PartitionEntryMBR partitions[4];
	unsigned __int16 signature;
	
}MBR, *PMBR;

typedef struct BiosLbaPacket
{
	char size;
	char reserved;
	unsigned __int16 sector_count;
	unsigned __int32 buffer;
	unsigned __int64 sector;

}BIOS_LBA_PACKET, *PBIOS_LBA_PACKET;

#pragma pack()

void read_sector( PUINT64_STRUCT sector, char drive, char* buffer );

#endif